package com.enjoyor.soa.traffic.core.efoms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.enjoyor.soa.traffic.core.efoms.domain.CheckRefreshInfo;
import com.enjoyor.soa.traffic.core.efoms.mapper.ICheckRefreshInfoMapper;
import com.enjoyor.soa.traffic.core.efoms.service.ICheckRefreshInfoService;
import com.enjoyor.soa.traffic.frame.logger.IPubLogMapper;
import com.enjoyor.soa.traffic.util.enums.log.LogInfoDic;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

@Service
public class CheckRefreshInfoService implements ICheckRefreshInfoService{

	@Autowired
	private ICheckRefreshInfoMapper checkRefreshInfoMapper;
	
	@Autowired
	private IPubLogMapper pubLogMapper;
	@Override
	public CheckRefreshInfo getCheckRefreshInfo(String devTypeCode) {
		// TODO Auto-generated method stub
		return checkRefreshInfoMapper.selectById(devTypeCode);
	}

	@Override
	public ResultPojo insertCheckRefreshInfo(CheckRefreshInfo checkRefreshInfo) {
		// TODO Auto-generated method stub
		checkRefreshInfoMapper.insertSelective(checkRefreshInfo);
		pubLogMapper.saveNoramlLogInfo(null, "自动刷新", LogInfoDic.LOG_TRANSTYPE_ENUM.TRANSTYPE_INSERT.getCode(),
				String.format("添加巡检刷新信息编号:{%s} 操作成功!", new Object[] {checkRefreshInfo.getId()}),
				LogInfoDic.LOG_MODULAR_ENUM.EFOMS_CHECK_MANAGEMENT.getMessage());
		return new ResultPojo();
	}

	@Override
	public ResultPojo updateCheckRefreshInfo(CheckRefreshInfo checkRefreshInfo) {
		// TODO Auto-generated method stub
		checkRefreshInfoMapper.updateByIdSelective(checkRefreshInfo);
		pubLogMapper.saveNoramlLogInfo(null, "自动刷新", LogInfoDic.LOG_TRANSTYPE_ENUM.TRANSTYPE_UPDATE.getCode(),
				String.format("添加巡检刷新信息编号:{%s} 操作成功!", new Object[] {checkRefreshInfo.getId()}),
				LogInfoDic.LOG_MODULAR_ENUM.EFOMS_CHECK_MANAGEMENT.getMessage());
		return new ResultPojo();
	}

}
